package com.xg.utils;

/**
 * @author MI
 * @ClassName Constant.java
 * @createTime 2021年08月17日 17:33:00
 */
public enum ConstantEnum {
    OK("0000", "成功"),
    FAIL("9000", "失败"),
    TIME_OUT("0800","设备轮询超时"),
    EQU_NET_ERR("9001", "设备网络异常"),
    EQU_MSG_ERR("9002", "设备报文异常");
    private String code;

    private String name;

    public static String getName(String code) {
        for (ConstantEnum constantEnum : ConstantEnum.values()) {
            if (constantEnum.getCode().equals(code)) {
                return constantEnum.getName();
            }
        }
        return null;
    }

    private ConstantEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
